﻿using System;
using System.IO;

namespace CoNatural.Data.VisualStudio.AddIn.Tools {
	class PathScriptProvider : CoNatural.Data.ICommandScriptProvider {
		string script;

		public PathScriptProvider(string path) {
			try {
				script = File.ReadAllText(Path.ChangeExtension(path, ".sql"));
			}
			catch {
				script = "Path to .sql file not found: " + path;
			}
		}

		#region ICommandScriptProvider Members

		public string GetScript(ICommand iCommand) {
			return script;
		}

		#endregion
	}
}
